package org.force4spring.query;

import java.util.ArrayList;
import java.util.List;

/**
 * Implementation of <code>Expression</code> which simply wraps a 
 * <code>String</code> representing SOQL path reference such as a 
 * field name or object name or relationship name.
 * 
 * @author Max Rudman
 */
public class PathExpression implements Expression {
	private String path;
	
	public PathExpression(String path) {
		this.path = path;
		assert (path != null);
	}
	
	public static List<PathExpression> create(String[] paths) {
		ArrayList<PathExpression> result = new ArrayList<PathExpression>(paths.length);
		for (int i=0;i<paths.length;i++) {
			result.add(new PathExpression(paths[i]));
		}
		return result;
	}

	/**
	 * @see org.force4spring.query.Expression#buildSOQL()
	 */
	public String buildSOQL() {
		return path;
	}
}
